-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
log: Set content type header for http sink #77014
Conversation
The content type header for the output of HTTP log sink is always set to text/plain irrespective of the log format. If the log format is JSON, we should set the content type to be application/json. Release note (bug fix): The content type header for the HTTP log sink is set to application/json if the format of the log output is JSON.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 5 files at r1, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @cameronnunez and @knz)
TFTR! bors r=dhartunian |
Build succeeded: |
Encountered an error creating backports. Some common things that can go wrong:
You might need to create your backport manually using the backport tool. error creating merge commit from 65c59a6 to blathers/backport-release-21.2-77014: POST https://api.github.com/repos/cockroachlabs/cockroach/merges: 403 Resource not accessible by integration [] you may need to manually resolve merge conflicts with the backport tool. Backport to branch 21.2.x failed. See errors above. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan. |
This is a fixup to cockroachdb#77014: - the content-type is not a property of the format *parser*, it's a property of the format itself. Touching `formatParsers` to compute it is an abstraction mismatch. - the content-type is constant for a given log config. There's no need to re-compute it on every log entry. It can be computed and stored once when the config is applied in `flags.go`. (Also, the `outputLogEntry` code is time-sensitive, so we don't want to give it more work.) - the content-type is only needed for HTTP sinks. No need to compute it for other sink types. So its retrieval can be confined to `newHTTPSink`. Release justification: bug fix Release note: None
please backport together with #77210 |
77210: util/log: only compute content-type once r=rimadeodhar a=knz This is a fixup to #77014: - the content-type is not a property of the format *parser*, it's a property of the format itself. Touching `formatParsers` to compute it is an abstraction mismatch. - the content-type is constant for a given log config. There's no need to re-compute it on every log entry. It can be computed and stored once when the config is applied in `flags.go`. (Also, the `outputLogEntry` code is time-sensitive, so we don't want to give it more work.) - the content-type is only needed for HTTP sinks. No need to compute it for other sink types. So its retrieval can be confined to `newHTTPSink`. Release justification: bug fix Release note: None Co-authored-by: Raphael 'kena' Poss <[email protected]>
This is a fixup to cockroachdb#77014: - the content-type is not a property of the format *parser*, it's a property of the format itself. Touching `formatParsers` to compute it is an abstraction mismatch. - the content-type is constant for a given log config. There's no need to re-compute it on every log entry. It can be computed and stored once when the config is applied in `flags.go`. (Also, the `outputLogEntry` code is time-sensitive, so we don't want to give it more work.) - the content-type is only needed for HTTP sinks. No need to compute it for other sink types. So its retrieval can be confined to `newHTTPSink`. Release justification: bug fix Release note: None
This is a fixup to cockroachdb#77014: - the content-type is not a property of the format *parser*, it's a property of the format itself. Touching `formatParsers` to compute it is an abstraction mismatch. - the content-type is constant for a given log config. There's no need to re-compute it on every log entry. It can be computed and stored once when the config is applied in `flags.go`. (Also, the `outputLogEntry` code is time-sensitive, so we don't want to give it more work.) - the content-type is only needed for HTTP sinks. No need to compute it for other sink types. So its retrieval can be confined to `newHTTPSink`. Release justification: bug fix Release note: None
The content type header for the output of HTTP log sink
is always set to text/plain irrespective of the log format.
If the log format is JSON, we should set the content
type to be application/json.
Release note (bug fix): The content type header for the
HTTP log sink is set to application/json if the format of
the log output is JSON.